Skip to content

Conversation

MaxDesiatov
Copy link
Contributor

Adds #if defined(__wasi__) in stdlib/public/stubs and implements _swift_stdlib_getUnsafeArgvArgc to fix corresponding code when compiling for WASI.

This is a part of SR-9307 and #24684.

(cc @kateinoigakukun)

@MaxDesiatov MaxDesiatov requested a review from gribozavr January 28, 2020 14:41
@@ -42,6 +42,10 @@
#include "swift/Runtime/Mutex.h"
#include "../SwiftShims/Random.h"

#if defined(__wasi__)
#include <algorithm> // required for std::min
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just make this unconditional. This is inside the implementation, so it is fine.

@@ -511,6 +513,8 @@ void swift::_swift_stdlib_flockfile_stdout() {
void swift::_swift_stdlib_funlockfile_stdout() {
#if defined(_WIN32)
_unlock_file(stdout);
#elif defined(__wasi__)
// WebAssembly/WASI doesn't support file locking yet
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a JIRA issue for supporting threading/locking on WASI and reference it here.

@MaxDesiatov MaxDesiatov requested a review from compnerd January 28, 2020 18:30
@compnerd
Copy link
Member

@swift-ci please smoke test

@compnerd compnerd merged commit 44a6475 into swiftlang:master Jan 29, 2020
@MaxDesiatov MaxDesiatov deleted the swiftwasm-shims branch January 29, 2020 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants